home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Dec 3, 1996
- //
- // Description:
- // This is a helper script to perform the setKey -breakdown true command
- // using the various options that have been set
- //
- // Input Arguments:
- // int action 0 - just execute the command
- // 1 - show the option box dialog
- // 2 - return the drag command
- //
- // Return Value:
- // None.
- //
-
- proc setOptionVars (int $forceFactorySettings)
- {
- // setBreakdownWhich:
- // 1 : set keyframes on all keyable attrs
- // 2 : set keyframes on all manip handle attrs
- // 3 : set keyframes on current manip handle
- //
- if( $forceFactorySettings || !`optionVar -exists setBreakdownWhich` ) {
- optionVar -intValue setBreakdownWhich 1;
- }
-
- if( $forceFactorySettings || !`optionVar -exists setBreakdownPrompt` ) {
- optionVar -intValue setBreakdownPrompt 0;
- }
-
- if( $forceFactorySettings || !`optionVar -exists setBreakdownHierarchy`) {
- optionVar -intValue setBreakdownHierarchy 0;
- }
- // use channel box attrs
- //
- if ($forceFactorySettings || !`optionVar -exists setBreakdownUseChannelBox`) {
- optionVar -intValue setBreakdownUseChannelBox 0;
- }
- // -controlPoints
- //
- if ($forceFactorySettings || !`optionVar -exists setBreakdownControlPoints`) {
- optionVar -intValue setBreakdownControlPoints 0;
- }
- // -shape
- //
- if ($forceFactorySettings || !`optionVar -exists setBreakdownShapes`) {
- optionVar -intValue setBreakdownShapes 1;
- }
- }
-
- global proc setBreakdownSetup (string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings
- //
- setOptionVars( $forceFactorySettings );
-
- setParent $parent;
-
- // Query the optionVar's and set the values into the controls
- //
- int $whichAttrs = `optionVar -query setBreakdownWhich`;
- switch($whichAttrs)
- {
- case 1:
- radioButtonGrp -edit -sl 1 allAttrsRB;
- break;
- case 2:
- radioButtonGrp -edit -sl 1 allManipAttrsRB;
- break;
- case 3:
- radioButtonGrp -edit -sl 1 curManipHandleRB;
- break;
- }
-
- if( `optionVar -query setBreakdownPrompt` == 1 ) {
- radioButtonGrp -e -select 2 setBreakdownPrompt;
- } else {
- radioButtonGrp -e -select 1 setBreakdownPrompt;
- }
-
- if (`optionVar -query setBreakdownHierarchy` == 1) {
- radioButtonGrp -edit -select 2 hierarchyRB;
- } else {
- radioButtonGrp -edit -select 1 hierarchyRB;
- }
-
- if (`optionVar -query setBreakdownUseChannelBox` == 1) {
- radioButtonGrp -edit -select 2 channelsRB;
- } else {
- radioButtonGrp -edit -select 1 channelsRB;
- }
-
- checkBoxGrp -edit -value1 `optionVar -query setBreakdownControlPoints` controlCB;
- checkBoxGrp -edit -value1 `optionVar -query setBreakdownShapes` shapesCB;
-
- breakdownEnabling $parent ($whichAttrs == 1);
- }
-
- global proc setBreakdownCallback (string $parent, int $doIt, string $selectionConnection)
- //
- // Description:
- // Set the optionVar's from the control values, and then perform
- // the command
- //
- {
- setParent $parent;
-
- if( `radioButtonGrp -q -sl allManipAttrsRB` == 1) {
- optionVar -intValue setBreakdownWhich 2;
- } else if( `radioButtonGrp -q -sl curManipHandleRB` == 1 ) {
- optionVar -intValue setBreakdownWhich 3;
- } else {
- optionVar -intValue setBreakdownWhich 1;
- }
-
- if (`radioButtonGrp -query -select setBreakdownPrompt` == 2) {
- optionVar -intValue setBreakdownPrompt 1;
- } else {
- optionVar -intValue setBreakdownPrompt 0;
- }
-
- if (`radioButtonGrp -query -select hierarchyRB` == 2) {
- optionVar -intValue setBreakdownHierarchy 1;
- } else {
- optionVar -intValue setBreakdownHierarchy 0;
- }
-
- if (`radioButtonGrp -query -select channelsRB` == 2) {
- optionVar -intValue setBreakdownUseChannelBox 1;
- } else {
- optionVar -intValue setBreakdownUseChannelBox 0;
- }
-
- optionVar -intValue setBreakdownControlPoints
- `checkBoxGrp -query -value1 controlCB`;
- optionVar -intValue setBreakdownShapes
- `checkBoxGrp -query -value1 shapesCB`;
-
- if ($doIt)
- {
- performSetBreakdown 0 $selectionConnection;
- string $tmpCmd = "performSetBreakdown 0 \"" + $selectionConnection + "\"";
- addToRecentCommandQueue $tmpCmd "SetBreakdown";
- }
- }
-
-
- global proc breakdownEnabling(string $parent, int $state)
- {
- setParent $parent;
-
- radioButtonGrp -edit -enable $state hierarchyRB;
- radioButtonGrp -edit -enable $state channelsRB;
-
- breakdownChannelsEnabling $parent
- ($state && (`radioButtonGrp -query -select channelsRB` == 1));
- }
-
- global proc breakdownChannelsEnabling(string $parent, int $state)
- {
- setParent $parent;
-
- checkBoxGrp -edit -enable $state controlCB;
- checkBoxGrp -edit -enable $state shapesCB;
- }
-
- proc string setBreakdownWidgets( string $parent )
- {
- setParent $parent;
-
- string $tabForm = `columnLayout -adjustableColumn true`;
-
- // Make a collection of 3 radio groups instead of one with 3 options,
- // so that we can line up the text on separate lines
- //
- radioButtonGrp -numberOfRadioButtons 1
- -label "Set Breakdowns on"
- -label1 "All Keyable Attributes"
- -cc ("breakdownEnabling "+ $parent+" #1")
- allAttrsRB;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "All Manipulator Handles"
- -shareCollection allAttrsRB
- allManipAttrsRB;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "Current Manipulator Handle"
- -shareCollection allAttrsRB
- curManipHandleRB;
-
- radioButtonGrp -numberOfRadioButtons 2
- -label "Set Breakdowns at"
- -label1 "Current Time"
- -label2 "Prompt"
- setBreakdownPrompt;
-
- separator -style "in";
-
- radioButtonGrp -numberOfRadioButtons 2
- -label Hierarchy -label1 "Selected" -label2 "Below"
- hierarchyRB;
-
- radioButtonGrp -numberOfRadioButtons 2 -label "Channels"
- -label1 "All Keyable"
- -label2 "From Channel Box"
- -cc1 ("breakdownChannelsEnabling " + $parent + " #1")
- channelsRB;
-
- checkBoxGrp -label "Control Points" -ncb 1 -label1 "" controlCB;
- checkBoxGrp -label "Shapes" -ncb 1 -label1 "" shapesCB;
-
- return $tabForm;
- }
-
- global proc setBreakdownOptions (string $selectionConnection)
- {
- string $commandName = "setBreakdown";
-
- string $applyTitle = "Set Breakdown";
-
- // Build the option box "methods"
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- // Get the option box.
- //
- // The value returned is the name of the layout to be used as
- // the parent for the option box UI.
- //
- string $layout = getOptionBox();
- setParent $layout;
-
- setOptionBoxCommandName($commandName);
-
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
- tabLayout -scr true -tv false; // To get the scroll bars
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- setBreakdownWidgets $parent;
-
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- // 'Apply' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit
- -label $applyTitle
- -command ($callback + " " + $parent + " " + 1 + " \"" + $selectionConnection + "\"")
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + " \"" + $selectionConnection + "\"; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- // Set the option box title.
- //
- setOptionBoxTitle("Set Breakdown Options");
-
- // Customize the 'Help' menu item text.
- //
- setOptionBoxHelpTag( "SetBreakdown" );
-
- // Set the current values of the option box.
- //
- eval (($setup + " " + $parent + " " + 0));
-
- // Show the option box.
- //
- showOptionBox();
- }
-
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- proc string assembleCmd(string $selectionConnection)
- {
- string $cmd;
-
- setOptionVars(false);
-
- // doSetKeyframeArgList takes a string array
- //
- $cmd = "doSetKeyframeArgList 3 { " +
- "\"" + `optionVar -query setBreakdownWhich` + "\"" +
- ",\"" + `optionVar -query setBreakdownHierarchy` + "\"" +
- ",\"" + `optionVar -query setBreakdownUseChannelBox` + "\"" +
- ",\"" + `optionVar -query setBreakdownControlPoints` + "\"" +
- ",\"" + `optionVar -query setBreakdownShapes` + "\"" +
- ",\"" + `optionVar -query setBreakdownPrompt` + "\"" +
- ",\"" + true + "\"" +
- ",\"" + $selectionConnection + "\"" +
- " };";
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // performSetBreakdown
- //
- // Description:
- // Perform the 'setKeyframe -breakdown true' command using the corresponding
- // option values. This procedure will also show the option box
- // window if necessary as well as construct the command string
- // that will invoke the 'setKeyframe -breakdown true' command with the current
- // option box values.
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- // Return Value:
- // None.
- //
- global proc string performSetBreakdown (int $action, string $selectionConnection)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- // Retrieve the option settings
- //
- setOptionVars(false);
-
- // Get the command.
- //
- $cmd = assembleCmd ($selectionConnection);
-
- // Execute the command with the option settings.
- //
- eval($cmd);
-
- break;
-
- // Show the option box.
- //
- case 1:
- setBreakdownOptions ($selectionConnection);
- break;
-
- // Return the command string.
- //
- case 2:
- // Retrieve the option settings.
- //
- setOptionVars (false);
-
- // Get the command.
- //
- $cmd = assembleCmd ($selectionConnection);
- break;
- }
- return $cmd;
- }
-